Repository navigation
Conversation
iacsha
requested review from
a team,
NicoPiel,
gibson9583,
jonbartels,
kayyagari,
kpalang,
ssrowe and
tonygermano
November 5, 2026 09:03
…OpenIntegrationEngine#498, fixes OpenIntegrationEngine#499) MirthLauncher runs Mirth as a Thread and never calls main(), so main() System.exit(0) never runs; an aborted startup just returned and left the JVM alive with no listeners. Exit on the port-in-use and MigrationException abort paths, and guard the shutdown hook with a startupComplete flag so exiting after a failed migration does not run the full shutdown (which hangs reading the stopped Derby database). Signed-off-by: iacsha <122627209+iacsha@users.noreply.github.com>
iacsha
force-pushed
the
fix/498-499-exit-on-startup-failure
branch
from
November 6, 2026 19:47
adaef4c to
25d059d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Exit cleanly when startup fails instead of leaving a zombie JVM (fixes #498, fixes #499)
Problem
MirthLauncherloadscom.mirth.connect.server.Mirthas aThreadand starts it; it nevercalls
Mirth.main(), somain()'sSystem.exit(0)never runs in the real launcher path.When
run()aborts a failed startup it simplyreturns — the Mirth thread dies, but thelauncher's non-daemon threads keep the JVM alive, so the process stays up with no listening
ports. A service manager sees it as running; nothing restarts or alerts (#498).
Two confirmed triggers:
MigrationException).On the migration path there is a second problem (#499): the shutdown hook, registered before
startup(), runs the fullMirth.shutdown(), which reads the database while stopping theengine. Startup already called
stopDatabase(), so on Derby the hook waits for a pooledconnection that never comes and hangs — the process must be
SIGKILLed.Fix
System.exit(EXIT_STARTUP_FAILURE)on both abort paths (port-in-use andMigrationException)so the JVM actually terminates with a non-zero status a service manager can see.
startupComplete; theShutdownHookruns the fullshutdown()only when startupcompleted. Exiting after a failed migration therefore skips the engine/database shutdown that
would hang on Derby.
Normal operation is unchanged: a server that finished starting still shuts down fully via the
hook and via the
SHUTDOWN_SERVERcommand.Verification
Built from this branch and run live (Open Integration Engine 4.7.0, embedded Derby, in Docker):
Port already in use — start a second instance while 8443 is taken:
Failed migration — set
SCHEMA_INFO.VERSIONto an unknown value, then start:MigrationException: Database schema version "99.0.0" is not recognized ...and theprocess exits code 1 in ~5s (no Derby shutdown hang, no
SIGKILLneeded).(The pre-fix port-in-use zombie was reproduced directly; the migration-path Derby hang matches the
behavior documented in #499 and shares the same root cause.)